import {LOGIN,OUTLOGIN } from '../constants'

const INITIAL_STATE = {
    logininfo:{
          username:'',
          password:'',
        }
      }
    function tologin (state = INITIAL_STATE,action){
        switch(action.type){
          case LOGIN:
          return{
            ...state,
            logininfo:{
              username:action.data.username,
              password:action.data.password,
            }
          }
          case OUTLOGIN:
          return{
            ...state,
            logininfo:{
             username:'',
              password:'',
            }
          }
          default:
          return state
        }
      }
    
export default  tologin